package com.hehua.Prototype;

/**
 * 浅拷贝测试
 */
public class Client {
    public static void main(String[] args) {
        WeeklyLog weeklyLog,log_new;
        weeklyLog = new WeeklyLog(); //创建原型对象
        Attachment attachment = new Attachment(); //创建附件对象
        weeklyLog.setAttachment(attachment);  //将附件添加到周报中
        log_new = weeklyLog.clone(); //调用克隆方法创建克隆对象
        //比较周报
        System.out.println("周报是否相同?"+(weeklyLog == log_new));
        //比较附件
        System.out.println("附件是否相同"+(weeklyLog.getAttachment() == log_new.getAttachment()));
        //result false true 周报对象被成功复制,附件对象复制失败
    }
}
